package com.bdsoft.actions.dicManage.Service.impl;

import com.bdsoft.actions.dicManage.Dao.DictionaryMapper;
import com.bdsoft.actions.dicManage.Service.DictionaryService;
import com.bdsoft.actions.dicManage.entity.DictDetail;
import com.bdsoft.actions.dicManage.entity.SysDictType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.UUID;

@Service
public class DictionaryServiceImpl implements DictionaryService {
    @Autowired
    private DictionaryMapper dictionaryMapper;

    // 字典类型
    @Override
    public List<SysDictType> getDictTypeList(String typeCode, String typeName) {
        return dictionaryMapper.selectDictType(typeCode, typeName);
    }
    @Override
    public int addDictType(SysDictType dictType) {
        UUID uuid=UUID.randomUUID();
        dictType.setId(uuid.toString());
        return dictionaryMapper.insertDictType(dictType);
    }
    @Override
    public int updateDictType(SysDictType dictType) {
        return dictionaryMapper.updateDictType(dictType);
    }
    @Override
    public int deleteDictType(String id) {
        return dictionaryMapper.deleteDictType(id);
    }
    @Override
    public SysDictType getDictTypeById(String id) {
        return dictionaryMapper.getDictTypeById(id);
    }

    // 字典明细
    @Override
    public List<DictDetail> getDictDetailList(String dictCode) {
        return dictionaryMapper.selectDictDetail(dictCode);
    }
    @Override
    public int addDictDetail(DictDetail detail) {
        UUID uuid=UUID.randomUUID();
        detail.setId(uuid.toString());
        return dictionaryMapper.insertDictDetail(detail);
    }
    @Override
    public int updateDictDetail(DictDetail detail) {
        return dictionaryMapper.updateDictDetail(detail);
    }
    @Override
    public int deleteDictDetail(String id) {
        return dictionaryMapper.deleteDictDetail(id);
    }
    @Override
    public DictDetail getDictDetailById(String id) {
        return dictionaryMapper.getDictDetailById(id);
    }
}
